varying float fade;
void main( void )
{
    vec4 viewCoords = gl_ModelViewProjectionMatrix * gl_Vertex;
    gl_Position     = ftransform();
	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
	
    fade = 1.0-clamp((viewCoords.z-gl_Fog.start)*gl_Fog.scale,0.0,1.0);
}